*Replicates tables in Online Appendix. Note, to run one table at a time, you must run the entire block of code for a given table at once.

*************************************************************
*Table B.1: Lower 48 States and Fracking Counties Comparison (1990 Variables)
*First row requires restricted CDC data. Comment out death rate section to have full table
************************************************************
use "$tmp\allstates.dta",clear
* Generate top quartile indicator and its complement
cap gen notoverplay = overplay==0
cap file close sumstat
file open sumstat using "$outappend/TableB1.txt", write replace
file write sumstat "Variable" _tab "Top-Quartile County"  _tab "Other Shale Play County" _tab "Within Play Difference" _n
file write sumstat _tab "(1)" _tab "(2)" _tab "(3)" _n 



	file write sumstat "Age-Adjusted Death Rate"
	reg adr2000dc0_gen0_eth00 notoverplay overplay if year == 1990 , nocons
	file write sumstat _tab %9.2f (_b[overplay]) _tab %9.2f (_b[notoverplay])
	
	reg adr2000dc0_gen0_eth00 overplay if year == 1990 ,  vce(robust)
	file write sumstat _tab %9.2f (_b[overplay])
	test overplay = 0
	loc p = r(p)
	if `p'<.01 {
		file write sumstat "***"
	}
	if `p'>=.01 & `p'<.05 {
		file write sumstat "**"
	}
	if `p'>=.05 & `p'<.1 {
		file write sumstat "*"
	}
	file write sumstat _n
	
	* Add standard deviations and standard error
	qui sum adr2000dc0_gen0_eth00 if overplay==1 & year == 1990
	loc sd_tq1 = r(sd)
	qui sum adr2000dc0_gen0_eth00 if notoverplay==1 & year == 1990
	loc sd_tq0 = r(sd)
	loc se_reg = _se[overplay]
	file write sumstat _tab "(" %5.2f (`sd_tq1') ")" _tab "(" %5.2f (`sd_tq0') ")" _tab "[" %5.2f (`se_reg') "]" _n


*Household Income
	file write sumstat "Median Household Income"
	reg medianhhinc1990 notoverplay overplay if year == 1990 , nocons
	file write sumstat _tab %9.2f (_b[overplay]) _tab %9.2f (_b[notoverplay])
	
	reg medianhhinc1990 overplay if year == 1990 ,  vce(robust)
	file write sumstat _tab %9.2f (_b[overplay])
	test overplay = 0
	loc p = r(p)
	if `p'<.01 {
		file write sumstat "***"
	}
	if `p'>=.01 & `p'<.05 {
		file write sumstat "**"
	}
	if `p'>=.05 & `p'<.1 {
		file write sumstat "*"
	}
	file write sumstat _n
	
	* Add standard deviations and standard error
	qui sum medianhhinc1990 if overplay==1 & year == 1990
	loc sd_tq1 = r(sd)
	qui sum medianhhinc1990 if notoverplay==1 & year == 1990
	loc sd_tq0 = r(sd)
	loc se_reg = _se[overplay]
	file write sumstat _tab "(" %5.2f (`sd_tq1') ")" _tab "(" %5.2f (`sd_tq0') ")" _tab "[" %5.2f (`se_reg') "]" _n



*High School Graduates
	file write sumstat "% High School Graduates"
	reg pcthighschool1990 notoverplay overplay if year == 1990 , nocons
	file write sumstat _tab %9.2f (_b[overplay]) _tab %9.2f (_b[notoverplay])
	
	reg pcthighschool1990 overplay if year == 1990 ,  vce(robust)
	file write sumstat _tab %9.2f (_b[overplay])
	test overplay = 0
	loc p = r(p)
	if `p'<.01 {
		file write sumstat "***"
	}
	if `p'>=.01 & `p'<.05 {
		file write sumstat "**"
	}
	if `p'>=.05 & `p'<.1 {
		file write sumstat "*"
	}
	file write sumstat _n
	
	* Add standard deviations and standard error
	qui sum pcthighschool1990 if overplay==1 & year == 1990
	loc sd_tq1 = r(sd)
	qui sum pcthighschool1990 if notoverplay==1 & year == 1990
	loc sd_tq0 = r(sd)
	loc se_reg = _se[overplay]
	file write sumstat _tab "(" %5.2f (`sd_tq1') ")" _tab "(" %5.2f (`sd_tq0') ")" _tab "[" %5.2f (`se_reg') "]" _n
	
*Manufacturing
	file write sumstat "% in Manufacturing"
	reg pctmanufacturing1990 notoverplay overplay if year == 1990 , nocons
	file write sumstat _tab %9.2f (_b[overplay]) _tab %9.2f (_b[notoverplay])
	
	reg pctmanufacturing1990 overplay if year == 1990 ,  vce(robust)
	file write sumstat _tab %9.2f (_b[overplay])
	test overplay = 0
	loc p = r(p)
	if `p'<.01 {
		file write sumstat "***"
	}
	if `p'>=.01 & `p'<.05 {
		file write sumstat "**"
	}
	if `p'>=.05 & `p'<.1 {
		file write sumstat "*"
	}
	file write sumstat _n
	
	* Add standard deviations and standard error
	qui sum pctmanufacturing1990 if overplay==1 & year == 1990
	loc sd_tq1 = r(sd)
	qui sum pctmanufacturing1990 if notoverplay==1 & year == 1990
	loc sd_tq0 = r(sd)
	loc se_reg = _se[overplay]
	file write sumstat _tab "(" %5.2f (`sd_tq1') ")" _tab "(" %5.2f (`sd_tq0') ")" _tab "[" %5.2f (`se_reg') "]" _n

*Married
	file write sumstat "% Married"
	reg pctmarried1990 notoverplay overplay if year == 1990 , nocons
	file write sumstat _tab %9.2f (_b[overplay]) _tab %9.2f (_b[notoverplay])

	reg pctmarried1990 overplay if year == 1990 ,  vce(robust)
	file write sumstat _tab %9.2f (_b[overplay])
	test overplay = 0
	loc p = r(p)
	if `p'<.01 {
		file write sumstat "***"
	}
	if `p'>=.01 & `p'<.05 {
		file write sumstat "**"
	}
	if `p'>=.05 & `p'<.1 {
		file write sumstat "*"
	}
	file write sumstat _n
	
	* Add standard deviations and standard error
	qui sum pctmarried1990 if overplay==1 & year == 1990
	loc sd_tq1 = r(sd)
	qui sum pctmarried1990 if notoverplay==1 & year == 1990
	loc sd_tq0 = r(sd)
	loc se_reg = _se[overplay]
	file write sumstat _tab "(" %5.2f (`sd_tq1') ")" _tab "(" %5.2f (`sd_tq0') ")" _tab "[" %5.2f (`se_reg') "]" _n

*Rural
	file write sumstat "% Rural"
	reg pctrural1990 notoverplay overplay if year == 1990 , nocons
	file write sumstat _tab %9.2f (_b[overplay]) _tab %9.2f (_b[notoverplay])

	reg pctrural1990 overplay if year == 1990 ,  vce(robust)
	file write sumstat _tab %9.2f (_b[overplay])
	test overplay = 0
	loc p = r(p)
	if `p'<.01 {
		file write sumstat "***"
	}
	if `p'>=.01 & `p'<.05 {
		file write sumstat "**"
	}
	if `p'>=.05 & `p'<.1 {
		file write sumstat "*"
	}
	file write sumstat _n
	
	* Add standard deviations and standard error
	qui sum pctrural1990 if overplay==1 & year == 1990
	loc sd_tq1 = r(sd)
	qui sum pctrural1990 if notoverplay==1 & year == 1990
	loc sd_tq0 = r(sd)
	loc se_reg = _se[overplay]
	file write sumstat _tab "(" %5.2f (`sd_tq1') ")" _tab "(" %5.2f (`sd_tq0') ")" _tab "[" %5.2f (`se_reg') "]" _n

*Veterans
	file write sumstat "% Veterans"
	reg pctveteran1990 notoverplay overplay if year == 1990 , nocons
	file write sumstat _tab %9.2f (_b[overplay]) _tab %9.2f (_b[notoverplay])

	reg pctveteran1990 overplay if year == 1990 ,  vce(robust)
	file write sumstat _tab %9.2f (_b[overplay])
	test overplay = 0
	loc p = r(p)
	if `p'<.01 {
		file write sumstat "***"
	}
	if `p'>=.01 & `p'<.05 {
		file write sumstat "**"
	}
	if `p'>=.05 & `p'<.1 {
		file write sumstat "*"
	}
	file write sumstat _n
	
	* Add standard deviations and standard error
	qui sum pctveteran1990 if overplay==1 & year == 1990
	loc sd_tq1 = r(sd)
	qui sum pctveteran1990 if notoverplay==1 & year == 1990
	loc sd_tq0 = r(sd)
	loc se_reg = _se[overplay]
	file write sumstat _tab "(" %5.2f (`sd_tq1') ")" _tab "(" %5.2f (`sd_tq0') ")" _tab "[" %5.2f (`se_reg') "]" _n

	*White
	file write sumstat "% White"
	reg pctwhite11990 notoverplay overplay if year == 1990 , nocons
	file write sumstat _tab %9.2f (_b[overplay]) _tab %9.2f (_b[notoverplay])
	
	reg pctwhite11990 overplay if year == 1990 ,  vce(robust)
	file write sumstat _tab %9.2f (_b[overplay])
	test overplay = 0
	loc p = r(p)
	if `p'<.01 {
		file write sumstat "***"
	}
	if `p'>=.01 & `p'<.05 {
		file write sumstat "**"
	}
	if `p'>=.05 & `p'<.1 {
		file write sumstat "*"
	}
	file write sumstat _n
	
	* Add standard deviations and standard error
	qui sum pctwhite11990 if overplay==1 & year == 1990
	loc sd_tq1 = r(sd)
	qui sum pctwhite11990 if notoverplay==1 & year == 1990
	loc sd_tq0 = r(sd)
	loc se_reg = _se[overplay]
	file write sumstat _tab "(" %5.2f (`sd_tq1') ")" _tab "(" %5.2f (`sd_tq0') ")" _tab "[" %5.2f (`se_reg') "]" _n

	*Foreign Born
	file write sumstat "% Foreign Born"
	reg pctforeignborn1990 notoverplay overplay if year == 1990 , nocons
	file write sumstat _tab %9.2f (_b[overplay]) _tab %9.2f (_b[notoverplay])
	
	reg pctforeignborn1990 overplay if year == 1990 ,  vce(robust)
	file write sumstat _tab %9.2f (_b[overplay])
	test overplay = 0
	loc p = r(p)
	if `p'<.01 {
		file write sumstat "***"
	}
	if `p'>=.01 & `p'<.05 {
		file write sumstat "**"
	}
	if `p'>=.05 & `p'<.1 {
		file write sumstat "*"
	}
	file write sumstat _n
	
	* Add standard deviations and standard error
	qui sum pctforeignborn1990 if overplay==1 & year == 1990
	loc sd_tq1 = r(sd)
	qui sum pctforeignborn1990 if notoverplay==1 & year == 1990
	loc sd_tq0 = r(sd)
	loc se_reg = _se[overplay]
	file write sumstat _tab "(" %5.2f (`sd_tq1') ")" _tab "(" %5.2f (`sd_tq0') ")" _tab "[" %5.2f (`se_reg') "]" _n


qui count if notoverplay == 1  & year == 1990
loc ncont = r(N)
qui count if overplay == 1  & year == 1990
loc ntreat = r(N)
file write sumstat "Observations" _tab %7.0f (`ntreat') _tab %7.0f (`ncont') _tab %7.0f (`ntreat' + `ncont') _n
file close sumstat


*************************************************************
*Table B.2: Age - Specific Mortality Rates by Gender
************************************************************
use "$tmp/final_playonly.dta", clear

forval i = 0/2 {
	loc panel = cond(`i'==0, "A",cond(`i'==1,"B","C"))
loc panelheader = cond(`i'==0, "Panel A: Overall",cond(`i'==1,"Panel B: Men","Panel C: Women"))

	reghdfe cdrdc0_gen`i'_eth00_a0024 ddtquartile1 $rhs $main
	qui su cdrdc0_gen`i'_eth00_a0024 if e(sample)==1
	loc ymean: di %9.2f r(mean)
	outreg2 using "$outappend/TableB2`panel'", tex(pretty) replace keep(ddtquartile1) ///
  	addtext(Controls,All,"Outcome Mean", `ymean')  label nocons title("`panelheader'") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	reghdfe cdrdc0_gen`i'_eth00_a2544 ddtquartile1 $rhs $main
	qui su cdrdc0_gen`i'_eth00_a2544 if e(sample)==1
	loc ymean: di %9.2f r(mean)
	outreg2 using "$outappend/TableB2`panel'", tex(pretty) append keep(ddtquartile1) ///
  	addtext(Controls,All,"Outcome Mean", `ymean')  label nocons title("`panelheader'") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	reghdfe cdrdc0_gen`i'_eth00_a4564 ddtquartile1 $rhs $main
	qui su cdrdc0_gen`i'_eth00_a4564 if e(sample)==1
	loc ymean: di %9.2f r(mean)
	outreg2 using "$outappend/TableB2`panel'", tex(pretty) append keep(ddtquartile1) ///
  	addtext(Controls,All,"Outcome Mean", `ymean')  label nocons title("`panelheader'") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes
	
		reghdfe cdrdc0_gen`i'_eth00_a6599 ddtquartile1 $rhs $main
	qui su cdrdc0_gen`i'_eth00_a6599 if e(sample)==1
	loc ymean: di %9.2f r(mean)
	outreg2 using "$outappend/TableB2`panel'", tex(pretty) append keep(ddtquartile1) ///
  	addtext(Controls,All,"Outcome Mean", `ymean')  label nocons title("`panelheader'") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes
}


*************************************************************
*Table B.3: Changes in Population by Age
************************************************************
use "$tmp/final_playonly.dta", clear

reghdfe l_pop_gen0_eth00_a2564 ddtquartile1 $rhs $main
outreg2 using "$outappend/TableB3", tex(pretty) replace keep(ddtquartile1) ///
	label nocons ctitle("") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	foreach age in 0024 2544 4564 6599 {
		reghdfe l_pop_gen0_eth00_a`age' ddtquartile1 $rhs $main
		outreg2 using "$outappend/TableB3", tex(pretty) append keep(ddtquartile1) ///
		label nocons ctitle("") ///
		bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes
}


*************************************************************
*Table B.4: Changes in Population by Gender
************************************************************
use "$tmp/final_playonly.dta", clear

reghdfe l_pop_gen1_eth00_a0024 ddtquartile1 $rhs $main
outreg2 using "$outappend/TableB4", tex(pretty) replace keep(ddtquartile1) ///
	label nocons ctitle("") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

foreach age in 2544 4564 6599 {
	reghdfe l_pop_gen1_eth00_a`age' ddtquartile1 $rhs $main
	outreg2 using "$outappend/TableB4", tex(pretty) append keep(ddtquartile1) ///
	label nocons ctitle("") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes
}
	
foreach a in 0024 2544 4564 6599 {
	reghdfe l_pop_gen2_eth00_a`a' ddtquartile1 $rhs $main
	outreg2 using "$outappend/TableB4", tex(pretty) append keep(ddtquartile1) ///
	label nocons ctitle("") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes
}


*************************************************************
*Table B.5: Changes in Population Composition
************************************************************
use "$tmp/final_playonly.dta", clear

reghdfe share_gen1_eth00_a0024 ddtquartile1 $rhs $main
outreg2 using "$outappend/TableB5", tex(pretty) replace keep(ddtquartile1) ///
	label nocons ctitle("") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

foreach age in 2544 4564 6599 {
	reghdfe share_gen1_eth00_a`age' ddtquartile1 $rhs $main
	outreg2 using "$outappend/TableB5", tex(pretty) append keep(ddtquartile1) ///
	label nocons ctitle("") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes
}
	
foreach a in 0024 2544 4564 6599 {
	reghdfe share_gen2_eth00_a`a' ddtquartile1 $rhs $main
	outreg2 using "$outappend/TableB5", tex(pretty) append keep(ddtquartile1) ///
	label nocons ctitle("") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes
}


*************************************************************
*Table B.6: Earnings by Gender - Robustness
************************************************************
use "$tmp/final_playonly.dta", clear
reghdfe lnearns_gen0_a1499 ddtquartile1 $rhs if balancesample == 1, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
outreg2 using "$outappend/TableB6", tex(pretty) replace keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", NO, "2000 Pop. Weights?",NO,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

reghdfe lnearns_gen0_a1499 ddtquartile1 $rhs if balancesample == 1 & year>=2002, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
outreg2 using "$outappend/TableB6", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", YES, "2000 Pop. Weights?",NO,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes 

reghdfe lnearns_gen0_a1499 ddtquartile1 $rhs [aw = pop2000] if  balancesample == 1 & year>=2002, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
outreg2 using "$outappend/TableB6", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", YES,"2000 Pop. Weights?",YES,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

reghdfe lnearns_gen0_a1499 ddtquartile1 $rhs $restrict
outreg2 using "$outappend/TableB6", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", NO,"2000 Pop. Weights?",YES,"Omits ND & MT?", YES) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes 

forval i = 1/2 {
	reghdfe lnearns_gen`i'_a1499 ddtquartile1 $rhs if balancesample == 1, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
	outreg2 using "$outappend/TableB6", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", NO,"2000 Pop. Weights?",NO,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	reghdfe lnearns_gen`i'_a1499 ddtquartile1 $rhs if  balancesample == 1 & year>=2002, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
	outreg2 using "$outappend/TableB6", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", YES, "2000 Pop. Weights?",NO,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	reghdfe lnearns_gen`i'_a1499 ddtquartile1 $rhs [aw = pop2000] if  balancesample == 1 & year>=2002,  absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
	outreg2 using "$outappend/TableB6", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", YES,"2000 Pop. Weights?",YES,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	reghdfe lnearns_gen`i'_a1499 ddtquartile1 $rhs $restrict
	outreg2 using "$outappend/TableB6", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", NO,"2000 Pop. Weights?",YES,"Omits ND & MT?", YES) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

}

*************************************************************
*Table B.7: Employment-to-population Ratio by Gender - Robustness
************************************************************
use "$tmp/final_playonly.dta", clear
reghdfe lnemptotal_gen0_a1499 ddtquartile1 $rhs if balancesample == 1, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
outreg2 using "$outappend/TableB7", tex(pretty) replace keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", NO, "2000 Pop. Weights?",NO,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

reghdfe lnemptotal_gen0_a1499 ddtquartile1 $rhs if balancesample == 1 & year>=2002, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
outreg2 using "$outappend/TableB7", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", YES, "2000 Pop. Weights?",NO,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

reghdfe lnemptotal_gen0_a1499 ddtquartile1 $rhs [aw = pop2000] if  balancesample == 1 & year>=2002, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
outreg2 using "$outappend/TableB7", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", YES,"2000 Pop. Weights?",YES,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

reghdfe lnemptotal_gen0_a1499 ddtquartile1 $rhs $restrict
outreg2 using "$outappend/TableB7", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", NO,"2000 Pop. Weights?",YES,"Omits ND & MT?", YES) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

forval i = 1/2 {
	reghdfe lnemptotal_gen`i'_a1499 ddtquartile1 $rhs if balancesample == 1, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
	outreg2 using "$outappend/TableB7", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", NO,"2000 Pop. Weights?",NO,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	reghdfe lnemptotal_gen`i'_a1499 ddtquartile1 $rhs if  balancesample == 1 & year>=2002, absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
	outreg2 using "$outappend/TableB7", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", YES, "2000 Pop. Weights?",NO,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	reghdfe lnemptotal_gen`i'_a1499 ddtquartile1 $rhs [aw = pop2000] if  balancesample == 1 & year>=2002,  absorb(splay1_year_fe cntyfips2000) vce(cl cntyfips2000)
	outreg2 using "$outappend/TableB7", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", YES,"2000 Pop. Weights?",YES,"Omits ND & MT?", NO) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	reghdfe lnemptotal_gen`i'_a1499 ddtquartile1 $rhs $restrict
	outreg2 using "$outappend/TableB7", tex(pretty) append keep(ddtquartile1) label nocons ctitle("") addtext("No Missing Counties?", NO,"2000 Pop. Weights?",YES,"Omits ND & MT?", YES) bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

}



*************************************************************
*Table B.8: Age-Adjusted Overall Mortality Rates by Gender
************************************************************
use "$tmp/final_playonly.dta", clear

*all
reghdfe adr2000dc0_gen0_eth00 ddtquartile1 $rhs $main
qui su adr2000dc0_gen0_eth00 if e(sample)==1
loc ymean: di %9.2f r(mean)
outreg2 using "$outappend/TableB8", tex(pretty) replace keep(ddtquartile1) ///
	label nocons ctitle("") addtext("Omits ND & MT?",NO,"Outcome Mean",`ymean') ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

reghdfe adr2000dc0_gen0_eth00 ddtquartile1 $rhs $restrict
qui su adr2000dc0_gen0_eth00 if e(sample)==1
loc ymean: di %9.2f r(mean)
outreg2 using "$outappend/TableB8", tex(pretty) append keep(ddtquartile1) ///
	label nocons ctitle("")  addtext("Omits ND & MT?",YES,"Outcome Mean",`ymean') ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

*Men	
reghdfe adr2000dc0_gen1_eth00 ddtquartile1 $rhs $main
qui su adr2000dc0_gen1_eth00 if e(sample)==1
loc ymean: di %9.2f r(mean)
outreg2 using "$outappend/TableB8", tex(pretty) append keep(ddtquartile1) ///
	label nocons ctitle("") addtext("Omits ND & MT?",NO,"Outcome Mean",`ymean') ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

reghdfe adr2000dc0_gen1_eth00 ddtquartile1 $rhs $restrict
qui su adr2000dc0_gen1_eth00 if e(sample)==1
loc ymean: di %9.2f r(mean)
outreg2 using "$outappend/TableB8", tex(pretty) append keep(ddtquartile1) ///
	label nocons ctitle("")  addtext("Omits ND & MT?",YES,"Outcome Mean",`ymean') ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

*Women	
reghdfe adr2000dc0_gen2_eth00 ddtquartile1 $rhs $main
qui su adr2000dc0_gen2_eth00 if e(sample)==1
loc ymean: di %9.2f r(mean)
outreg2 using "$outappend/TableB8", tex(pretty) append keep(ddtquartile1) ///
	label nocons ctitle("") addtext("Omits ND & MT?",NO,"Outcome Mean",`ymean') ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

reghdfe adr2000dc0_gen2_eth00 ddtquartile1 $rhs $restrict
qui su adr2000dc0_gen2_eth00 if e(sample)==1
loc ymean: di %9.2f r(mean)
outreg2 using "$outappend/TableB8", tex(pretty) append keep(ddtquartile1) ///
	label nocons ctitle("")  addtext("Omits ND & MT?",YES,"Outcome Mean",`ymean') ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

	
*************************************************************
*Table B.9: Infant Mortality Rates
************************************************************
*Note: Infant mortality rates typically measured as deaths per 1000 live births. As per table notes, define here as number of death rate of children under 1 per 1000 population under 1.
use "$tmp/final_playonly.dta", clear

reghdfe infant_mortality_gen0 ddtquartile1 $rhs $main
qui su infant_mortality_gen0 if e(sample)==1
loc ymean: di %9.2f r(mean)
outreg2 using "$outappend/TableB9", tex(pretty) replace keep(ddtquartile1) ///
  	addtext(Controls,YES,"Outcome Mean", `ymean')  label nocons ctitle("") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

forval i = 1/2 {
	reghdfe infant_mortality_gen`i' ddtquartile1 $rhs $main
	qui su infant_mortality_gen`i' if e(sample)==1
	loc ymean: di %9.2f r(mean)
	outreg2 using "$outappend/TableB9", tex(pretty) append keep(ddtquartile1) ///
  	addtext(Controls,YES,"Outcome Mean", `ymean')  label nocons ctitle("") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes
}

*************************************************************
*Table B.10: Traffic Accidents by Vehicle Type
************************************************************
use "$tmp/final_playonly.dta", clear

reghdfe vaccidents_r ddtquartile1 $rhs $main
qui su vaccidents_r if e(sample)==1
loc ymean: di %9.2f r(mean)

outreg2 using "$outappend/TableB10", tex(pretty) replace keep(ddtquartile1) ///
  	addtext(Controls,"All","Outcome Mean", `ymean')  label nocons ctitle("All Vehicles") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes


reghdfe truckaccidents_r ddtquartile1 $rhs $main
qui su truckaccidents_r if e(sample)==1
loc ymean: di %9.2f r(mean)

outreg2 using "$outappend/TableB10", tex(pretty) append keep(ddtquartile1) ///
  	addtext(Controls,"All","Outcome Mean", `ymean')  label nocons ctitle("Any Truck Involved") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes


qui reghdfe vaccidents_notrucks_r ddtquartile1 $rhs $main
qui su vaccidents_notrucks_r if e(sample)==1
loc ymean: di %9.2f r(mean)

outreg2 using "$outappend/TableB10", tex(pretty) append keep(ddtquartile1) ///
  	addtext(Controls,"All","Outcome Mean", `ymean')  label nocons ctitle("No Truck Involved") ///
	bdec(3) sdec(4) bfmt(fc) se bracket nor2 nonotes

